import os
import json

# 结果文件夹路径
results_dir = os.path.join(os.path.dirname(__file__), r'C:\graph-of-thoughts-main1\examples\set_intersection\results\deepseek_got_2025-07-18_20-31-03')

correct_ids = []

for filename in os.listdir(results_dir):
    if filename.startswith('got') and filename.endswith('.json'):
        file_path = os.path.join(results_dir, filename)
        with open(file_path, 'r', encoding='utf-8') as f:
            try:
                data = json.load(f)
                if data.get('problemsolved') is True:
                    # 提取编号，假设文件名格式为 got_编号.json 或 got编号.json
                    num = ''.join(filter(str.isdigit, filename))
                    correct_ids.append(num)
            except Exception as e:
                print(f"读取 {filename} 时出错: {e}")

print(f"problemsolved 为 true 的编号: {correct_ids}")
print(f"总数量: {len(correct_ids)}")
